package com.eva.notice.api;

import com.eva.framework.common.api.BaseController;
import com.eva.framework.common.model.ApiResponse;
import com.eva.notice.biz.SystemNoticeBiz;
import com.eva.notice.biz.vo.SystemNoticeProfileVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "系统通知")
@Slf4j
@RestController
@RequestMapping("/system/notice")
public class SystemNoticeController extends BaseController {

    @Resource
    private SystemNoticeBiz systemNoticeBiz;

    @ApiOperation("查询最新的通知列表")
    @GetMapping("/latest")
    public ApiResponse<List<SystemNoticeProfileVO>> getLatestNotices(@ApiParam("通知的条数") Integer count) {
        return ApiResponse.success(systemNoticeBiz.findLatestList(count));
    }
}
